// run: $exec < input
#include <iostream>
#include <algorithm>
#include <vector>

int const maxn = 20;
int a[maxn];
int n, l, r, x;

int bit_count_one(int x)
{
	x = (x & 0x55555555) + ((x>>1) & 0x55555555);
	x = (x & 0x33333333) + ((x>>2) & 0x33333333);
	x = (x & 0x0F0F0F0F) + ((x>>4) & 0x0F0F0F0F);
	x = (x & 0x00FF00FF) + ((x>>8) & 0x00FF00FF);
	x = (x & 0x0000FFFF) + ((x>>16)& 0x0000FFFF);
	return x;
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n >> l >> r >> x;
	for (int i = 0; i < n; i++) std::cin >> a[i];
	int ans = 0;
	for (int i = 0; i < (1 << n); i++) {
		if (bit_count_one(i) < 2) continue;
		std::vector<int> v;
		int sum = 0;
		for (int j = 0; j < n; j++)
			if ((i >> j) & 1) {
				sum += a[j];
				v.push_back(a[j]);
			}
		if (!(l <= sum && sum <= r)) continue;
		std::sort(v.begin(), v.end());
		if (v[v.size() - 1] - v[0] < x) continue;
		ans++;
	}
	std::cout << ans << "\n";
}

